package com.mm.dictionary.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mm.dictionary.domain.po.Word;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface WordMapper extends BaseMapper<Word> {
    @Update("UPDATE t_word SET count = count+#{count},update_time = #{updateTime} where word=#{word} and uid = #{uid}")
    public int updateCountInt(Word word);

    @Select("select * from t_word where uid=#{uid} order by update_time desc limit #{start},#{capacity}")
    List<Word> selectAllByUpdateTime(@Param("uid")long uid, @Param("start") int start, @Param("capacity") int capacity);

    @Select("select * from t_word where uid=#{uid} order by count desc limit #{start},#{capacity}")
    List<Word> selectAllByCount(@Param("uid")long uid, @Param("start") int start, @Param("capacity") int capacity);
}
